﻿using Cherry.Agile.Enterprise.Entity;
using Cherry.Agile.Framework.Query;
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;

namespace Cherry.Agile.Enterprise.Services.Interface
{
    [ServiceContract(Namespace = Unity.Namespace)]
    public interface ICategoryItemService : IOpenCategoryItemService
    {
        /// <summary>
        /// 获取字典项
        /// </summary>
        /// <returns>字典项集合</returns>
        [OperationContract]
        List<CategoryItem> SyncCategoryItem();

        /// <summary>
        /// 获取所有键值列表
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        List<CategoryItem> GetItems();

        /// <summary>
        /// 新增键值
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        [OperationContract]
        void AddItem(CategoryItem value);

        /// <summary>
        /// 修改键值
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        [OperationContract]
        void UpdateItem(CategoryItem value);

        /// <summary>
        /// 逻辑删除
        /// </summary>
        /// <param name="idArray">字典项ID数组</param>
        /// <returns></returns>
        [OperationContract]
        void DeleteItems(int[] idArray);

        /// <summary>
        /// 获得键值
        /// </summary>
        /// <param name="keyID"></param>
        /// <returns></returns>
        [OperationContract]
        CategoryItem GetCategoryItemByID(int keyID);


        /// <summary>
        /// 根据 key 类型 和key的值 获取key信息，不存在返回NULL
        /// </summary>
        /// <param name="categoryId">字典类型</param>
        /// <param name="keyValue">字典值</param>
        /// <returns>字典信息</returns>
        [OperationContract(Name = "GetCategoryItemById")]
        CategoryItem GetCategoryItem(int categoryId, int keyValue);

        /// <summary>
        /// 根据 categoryItemId 获取一个实体，不存在返回NULL
        /// </summary>
        /// <param name="categoryItemId">字典ID</param>
        /// <returns>字典信息</returns>
        [OperationContract]
        CategoryItem GetCategoryItem(int categoryItemId);

        /// <summary>
        /// 获取制定类型下的键值列表
        /// </summary>
        /// <param name="categoryId">键类型ID</param>
        /// <param name="paging">分页信息</param>
        /// <returns></returns>
        [OperationContract]
        List<CategoryItem> GetCategoryItemByCategoryID(int categoryId, Pagination paging);

        /// <summary>
        /// 判断键值是否存在
        /// </summary>
        /// <param name="itemValue"></param>
        /// <returns></returns>
        [OperationContract]
        bool IsValueExist(sbyte itemValue, int categoryID);

        /// <summary>
        /// 获取会员状态，去除选择和未开通 只用会员选择页面
        /// </summary>
        /// <returns>选择页面会员状态</returns>
        [OperationContract]
        List<CategoryItem> GetCategoryItemForShortStatusCache();
    }
}
